# -*- coding: utf-8 -*-

import pandas as pd
import numpy as np
from pandas import Series, DataFrame

s1 = Series([1, 2, np.nan, 3, 4], index=['A', 'B', 'C', 'D', 'E'])
print(s1.notnull)

# 删除NaN元素
print(s1.dropna())

df = DataFrame([[1,2,3],[np.nan,5,6],[7,np.nan,9],[np.nan,np.nan,np.nan]])
print(df)

# 删除NaN超过两个的行
print(df.dropna(axis=0, thresh=2))

# 填充null值
print(df.fillna(value={0: 0, 1: 1}))

